﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace asp.netWenFroms
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        //登录
        protected void logins_Click(object sender, EventArgs e)
        {
            var uid = txtUsername.Text.Trim();
            var pwd = txtPassword.Text.Trim();

            var sql = string.Format("select * from users where username='{0}'and password='{1}'", uid, pwd);
            var dt = DbHelper.GetDataTable(sql);
            if (dt.Rows.Count == 1)
            {
                Response.Redirect("Default.aspx");
                lbcomment.Text = "登录成功!";

            }
            else
            {
                lbcomment.Text = "登录失败！,过期、删除、账号或密码错误";
            }
        }
        //取消
        protected void cancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("Login.aspx");
        }
    }
}